using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using DevExpress.XtraReports.UI;

namespace ReportiFin
{
    public partial class ObPutGrupa : DevExpress.XtraReports.UI.XtraReport
    {
        public ObPutGrupa()
        {
            InitializeComponent();
        }


        private List<DataSet> obl;
         public ObPutGrupa(  List<DataSet> obracun)
        {
            InitializeComponent();
             obl = obracun;

        }
        void PrintingSystem_StartPrint(object sender, DevExpress.XtraPrinting.PrintDocumentEventArgs e)
        {
            e.PrintDocument.PrinterSettings.Copies = Convert.ToInt16(1);
        }
         
       
        private void ObPutGrupa_AfterPrint(object sender, EventArgs e)
         {
            foreach (DataSet dataSet in obl)
            {
              ObracunPutovanja _obID2 = new ObracunPutovanja(dataSet);
             XtraReport _obIDParent = ((XtraReport)this);
                                                       
                                                        _obID2.Name = string.Format("putovanje");
                                                        _obID2.Margins = _obIDParent.Margins;
                                                        _obID2.PrinterName =  _obIDParent.PrintingSystem.PageSettings.PrinterName;
                                                        //_report.PrintingSystem.PageSettings.PrinterName = printertoprint;
                                                        _obID2.PrintingSystem.StartPrint += PrintingSystem_StartPrint;

                                                        _obID2.PrintingSystem.ShowMarginsWarning = false;
                                                        _obID2.PaperKind =
                                                            _obIDParent.PrintingSystem.PageSettings.PaperKind;
                                                        _obID2.PaperName =  _obIDParent.PrintingSystem.PageSettings.PaperName;
                                                        _obID2.PrintingSystem.PageSettings.Assign(
                                                            _obIDParent.PrintingSystem.PageSettings.Margins,
                                                            _obIDParent.PrintingSystem.PageSettings.PaperKind,
                                                            _obIDParent.PrintingSystem.PageSettings.PaperName, _obIDParent.PrintingSystem.PageSettings.Landscape);
                                                        _obID2.PrintingSystem.PageSettings.Landscape = _obIDParent.PrintingSystem.PageSettings.Landscape;
                                                        //_obID2.PrintingSystem.PageSettings.Landscape = true;
                                                        _obID2.Margins = _obIDParent.PrintingSystem.PageSettings.Margins;
                                                   //     _obID2.PrintingSystem = _obID.PrintingSystem;
                                                        _obID2.CreateDocument();
                                                        _obIDParent.Pages.AddRange(_obID2.Pages);   
            }
             


         }
        

    }
}
